package cn.com.smartdevices.bracelet.chart.base;

import android.content.Context;
import android.graphics.Canvas;
import android.graphics.RectF;

/* renamed from: cn.com.smartdevices.bracelet.chart.base.q */
public abstract class PieChart extends BaseChart<Item> { // C0760q
    protected float mMaxValue; // f3981a
    protected float mValue;//f3982b;
    protected float mRadius; // f3983c;
    protected float mRate;// f3984d;
    protected float mRotate; // f3985e;
    protected float f3986f;

    public PieChart(Context context) {
        super(context);
        this.f3986f = -1;
    }

    protected void draw(Canvas canvas, RectF rectF, float f) { //m8668a
        drawPie(canvas, rectF, rectF.left + this.mRadius, rectF.top + this.mRadius, this.mRadius, this.mRate, f);
    }

    protected abstract void drawPie(Canvas canvas, RectF rectF, float f, float f2, float f3, float f4, float f5);

    protected void onRectChanged (RectF rectF) { //m8670a
        this.mRadius = Math.min(rectF.width(), rectF.height()) / 2.0f;
    }

    public void  setMaxValue (float f) { // m8671c
        this.mMaxValue = f;
        updateRate();
    }

    public void m8672d(int i) {
        this.f3986f = (float) i;
    }

    public float getMaxValue () { //m8673e
        return this.mMaxValue;
    }

    public void setValue (float f) { // m8674f
        this.mValue = f;
        updateRate();
    }

    protected void updateRate () { //m8675g
        if (this.mMaxValue == 0.0f) {
            this.mRate = 0.0f;
        } else if (this.mValue >= this.mMaxValue) {
            this.mRate = 1.0f;
        } else {
            this.mRate = this.mValue / this.mMaxValue;
        }
    }

    public void rotate (float f) { // m8676g
        this.mRotate = f;
    }
}
